trimmed_mean Interface

public interface trimmed_mean

Module Procedures

private function trimmed_mean_array(x, p) result(rst)

Computes the trimmed mean of a data set.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(inout), dimension(:) :: x

An N-element array containing the data. On output, the array is sorted into ascending order.

real(kind=real64), intent(in), optional :: p

An optional parameter specifying the percentage of values from either end of the distribution to remove. The default is 0.05 such that the bottom 5% and top 5% are removed.

Return Value real(kind=real64)

Trimmed mean; invalid p or empty/nonfinite data give NaN.

private function trimmed_mean_column(x, p) result(rst)

Computes the trimmed mean and sorts the column's values in ascending order. Uses a borrowed view without reallocating the underlying array.

Arguments

Type IntentOptional Attributes Name
class(data_column), intent(inout), target :: x

The input column; sorted on success, unchanged for invalid inputs. Unallocated storage is treated as empty.

real(kind=real64), intent(in), optional :: p

Fraction to remove from each end, in [0, 0.5); defaults to 0.05.

Return Value real(kind=real64)

Trimmed mean; empty/nonfinite data or invalid/nonfinite p give NaN.